﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zxb.DayWork.Core;

namespace Zxb.DayWork.Logic
{
    public abstract class BatchLoopWorker : IRun
    {
        protected abstract void ReadData();

        protected abstract void ProcessData();

        protected abstract void WriteData();

        protected abstract void InitLoopCondition();

        protected abstract bool CanContinue();

        protected abstract void UpdateLoopCondition();

        public void Run()
        {
            InitLoopCondition();
            while (CanContinue())
            {
                ReadData();
                ProcessData();
                WriteData();
                UpdateLoopCondition();
            }
        }
    }
}
